package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ReversesTheArrayInPlace {
	public static <T> T[] reverse(T[] array) {
		if (array == null)
			return array;

		int s = 0;
		int e = array.length - 1;
		while (s < e) {
			T tmp = array[e];
			array[e] = array[s];
			array[s] = tmp;

			s++;
			e--;
		}

		return array;
	}
}
